APP_NAME={{cookiecutter.module_name}}
PYTHON=.venv/bin/python3
INTERPRETER=/usr/bin/python3
.PHONY: help test


all: help

init: ## create a venv
	$(INTERPRETER) -m venv .venv
	cp .env.example .env

install:
	$(PYTHON) -m pip install -r requirements.txt

data: ## download the mnist data
	$(PYTHON) -m $(APP_NAME) data:download 

run: ## run the pipeline (train)
	$(PYTHON) -m $(APP_NAME) pipeline:train 

serve: ## start fastapi uvicorn server
	$(PYTHON) -m $(APP_NAME) app:serve

docs: ## serve the mdbook docs directory
	mdbook serve docs

test: ## run pytest tests
	$(PYTHON) -m pytest

test-watch: ## run pytest on .py changes
	find . -iname "*.py" | entr -c $(PYTHON) -m pytest

help: ## display this help message
	@echo "available commands:"
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36mmake %-30s\033[0m %s\n", $$1, $$2}'
